<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>표준원산지관리시스템:::FTA 협정관리</title>
<link rel="stylesheet" type="text/css" href="<c:url value='/css/common.css'/>" media="all" />
<script type="text/JavaScript">
	<!--
	function MM_swapImgRestore() { //v3.0
	  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
	}
	
	function MM_preloadImages() { //v3.0
	  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
	}
	
	function MM_findObj(n, d) { //v4.01
	  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	  if(!x && d.getElementById) x=d.getElementById(n); return x;
	}
	
	function MM_swapImage() { //v3.0
	  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
	}
	//-->
	function fn_apply() {
		var form = document.forms['formOms01'];
		form.action="<c:url value='/codeMng/ftamng_apply.do'/>";
		form.submit();
	}
	
	function fn_noApply() {
		var form = document.forms['formOms01'];
		form.action="<c:url value='/codeMng/ftamng_noapply.do'/>";
		form.submit();
	}
	
	function fn_selectAllorNot(obj) {
		var id = document.getElementsByName("ids");
		var allcheck = obj.checked;
		if(id.length) {
			for ( var i = 0; i < id.length; i++) {
				id[i].checked = allcheck;
			}
		}
	}

	function fn_linkPage(page) {
		var form = document.forms['formOms01'];
		form.action="<c:url value='/codeMng/ftamng_select.do'/>";
		form.pageIndex.value = page;
		form.submit();	
	}

	function fn_selectfta(id) {
		var form = document.forms['formOms01'];
		form.action = "<c:url value='/codeMng/ftamng_selectfta.do'/>";
		//checkbox가 선택되어 있다면 모두 Deselect한다
	    var object = form.id;
	    if(object.length) {
		    for(var i=0; i<object.length; i++) {
		    	if(object[i].checked) {
				    object[i].checked = false;
			    }
		    }
	    }
	    form.id.value = id;
	    form.submit();
	}
</script>
</head>
<body onload="MM_preloadImages('<%=request.getContextPath()%>/images/tab_on_01.jpg','<%=request.getContextPath()%>/images/tab_on_02.jpg','<%=request.getContextPath()%>/images/tab_on_03.jpg')">

<!-- 바로가기 메뉴 -->
<div class="accessibility">
	<ul>
		<li><a href="#mainNav">주메뉴바로가기</a></li>
		<li><a href="#subMenu">서브메뉴바로가기</a></li>
		<li><a href="sub_contents">콘텐츠바로가기</a></li>		
	</ul>
</div>

<!-- top 영역 시작 -->
<div id="top">
	<!-- 로그인 사용자정보 시작 -->
	<%@include file="/WEB-INF/jsp/oms/include/userinfo.jsp" %>
	<!-- 로그인 사용자정보 끝 -->
</div>
<!-- top 영역 끝 -->

<!-- 왼쪽영역 시작 -->
<div id="left">
	<!-- 왼쪽메뉴 시작 -->
	<%@include file="/WEB-INF/jsp/oms/include/leftmenu.jsp" %>
	<!-- 왼쪽메뉴 끝 -->
	<!-- 대쉬보드 시작-->
	<%@include file="/WEB-INF/jsp/oms/include/dashboard.jsp" %>	
	<!-- 대쉬보드 끝-->

</div>
<!-- 왼쪽영역 끝 -->



<!-- 콘텐츠 영역 시작 -->
<div id="container">
	<h3 class="tit"><span><strong>협정관리 (OMS01)</strong></span></h3>
	<!-- 콘텐츠 감싸기 시작 -->
	<div id="contents">
		<div class="governing">
		원산지 판정을 위한 협정을 관리합니다.<br />
		협정을 선택하여 적용, 미적용을 적용함으로써 원산지 판정적용 여부를 결정할 수 있습니다.
		</div>	
		<br />
		<br />

	
	<!-- 데이터 테이블 시작 -->
	<div id="data">
		<form name="formOms01" method="post">
		<input type="hidden" name="pageIndex" value="${ftaSearchVO.pageIndex}"/>
		<input type="hidden" name="id"/>
		<table cellpadding="0" cellspacing="0" class="topline">
			<colgroup>
				<col width="4%" />
				<col width="12%" />
				<col width="10%" />
				<col width="8%" />
				<col width="10%" />
				<col width="10%" />
				<col width="8%" />
				<col width="12%" />
				<col width="8%" />
				<col width="*" />
			</colgroup>
			<tr>
				<th class="thC"><input type="checkbox" id="check" onclick="fn_selectAllorNot(this);"/></th>
				<th class="thC">협정명</th>
				<th class="thC">발효일자</th>
				<th class="thC">협정적용여부</th>
				<th class="thC">증명방식</th>
				<th class="thC">증명서유효기간(개월)</th>
				<th class="thC">누적기준 적용여부</th>
				<th class="thC">서식 언어</th>
				<th class="thC">사용원칙</th>
				<th class="thC">서식</th>
			</tr>
			<c:forEach var="fta" items="${ftas}">
			<tr>
				<td class="tdGrayC"><input type="checkbox" name="ids" value="${fta.id}" class="brdrN" /></td>
				<td class="tdGrayC"><a href="#" onclick="fn_selectfta('${fta.id}'); return false;"><c:out value="${fta.name}"/></a></td>
				<td class="tdGrayC"><c:out value="${fta.effectiveDate}"/></td>
				<td class="tdGrayC"><c:if test="${fta.apply}">Y</c:if><c:if test="${!fta.apply}">N</c:if></td>
				<td class="tdGrayC"><c:out value="${fta.certificateType}"/></td>
				<td class="tdGrayC"><c:out value="${fta.avaiableDate}"/></td>
				<td class="tdGrayC"><c:if test="${fta.applyAccumulation}">Y</c:if><c:if test="${!fta.applyAccumulation}">N</c:if></td>
				<td class="tdGrayC"><c:out value="${fta.language}"/></td>
				<td class="tdGrayC"><c:out value="${fta.useRule}"/></td>
				<td class="tdGrayC"><c:out value="${fta.form}"/></td>
			</tr>	
			</c:forEach>
		</table>
		</form>
	</div>
	<!-- 데이터 테이블 끝 -->
	
	<!-- 왼쪽정렬 버튼 시작 -->
	<div class="btnL">
		<ul>
			<li><a href="#" onclick="fn_apply()"><img src="<%=request.getContextPath()%>/images/btn/btn_applicable.jpg" alt="적용" /></a></li>
			<li><a href="#" onclick="fn_noApply()"><img src="<%=request.getContextPath()%>/images/btn/btn_Napplicable.jpg" alt="미적용" /></a></li>
		</ul>
	</div>
	<!-- 왼쪽정렬 버튼 끝 -->
	
	<!-- 페이징 시작 -->
	<div class="paginate"><ui:pagination paginationInfo = "${paginationInfo}" jsFunction="fn_linkPage"/></div>
	<!-- 페이징 끝 -->

	</div>
	<!-- 콘텐츠 감싸기 시작 -->
</div>
<!-- 콘텐츠 영역 끝 -->
</body>
</html>